-
Notifications
You must be signed in to change notification settings - Fork 103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(explorer): update project and migrate to vite #3579
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
@@ -100,6 +100,7 @@ export class Erc20ApiImpl implements Erc20Api { | |||
|
|||
public constructor(injectedDependencies: Erc20ApiDependencies) { | |||
Object.assign(this, injectedDependencies) | |||
this.web3 = injectedDependencies.web3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to fix typescript error
@@ -29,3 +30,15 @@ export function useResolveEns(address: string): AddressAccount | undefined { | |||
|
|||
return addressAccount | |||
} | |||
|
|||
async function resolveENS(name: string): Promise<string | null> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move the function from another file because here is the only place where it is used
return networkId || Network.MAINNET | ||
} | ||
|
||
export const NetworkUpdater: React.FC = () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just extracted the component from state/network/updater.tsx
to solve circular dependency
@@ -81,7 +81,7 @@ const plurals: LocalePlural = { | |||
export async function dynamicActivate(locale: SupportedLocale) { | |||
i18n.loadLocaleData(locale, { plurals: plurals[locale] }) | |||
try { | |||
const catalog = await import(`../locales/${locale}.js?lingui`) | |||
const catalog = await import(`../locales/${locale}.po`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the only change in cowswap
app related to vite
update
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Finished with code review, will test the app next.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should probably get rid of this.
Not for this PR, though.
try { | ||
order = await getOrderApi.api({ ...getOrderApi.defaultParams, networkId }) | ||
order = await getOrderApi.api({ ...getOrderApi.defaultParams, networkId } as never) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why as never
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
package.json
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How does CoW Swap build looks like after this?
I hope vite is smart enough to not include any of the new dependencies in the unrelated build, but I you never know.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://swap-dev-git-feat-explorer-3-cowswap.vercel.app/#/1/swap/WETH
I don't see any excessive size comparing with prod
5c14e8f
to
18741d1
Compare
Summary
This is the final PR in the sequence:
In this PR you can find many files changed, but don't worry, most of them contain only import changes and code-style fixes.
I've left several
TODO: MGR
comments at places where I've changed to code but haven't tested it.Changes
vite
to fix a bug with loading schema file for app-data.In the previous version of
vite
the code above didn't work due to some problem inside ofvite
.First time I've faced this issue in Istanbul during the hackathon.
Migrated favicon
Set up jest
Integrated
loadConfig.js
tovite
configMoved
test
directory inside ofsrc
Moved
src/apps/explorer
tosrc/explorer
because it was confusing typescript since we haveapps
directory in the root of repoMigrated react-router to the 6.x version (guide)
Changed
require.context
toimport.meta.glob
since we migrated fromwebpack
tovite
To Test
All Explorer functionalities.
Probably better to tests via #3580 to avoid double work